package wt.hpad.model.adapter;

import android.graphics.Color;

import java.util.List;

import q.rorbin.verticaltablayout.adapter.TabAdapter;
import q.rorbin.verticaltablayout.widget.ITabView;
import q.rorbin.verticaltablayout.widget.QTabView;
import wt.hpad.model.bean.DishType;

/**
 * 分类 tab 数据适配器
 * Created by wt on 1.2.
 */

public class TypeTabAdapter<T> implements TabAdapter {
    private List<T> mDatas;

    public TypeTabAdapter(List<T> mDatas) {
        this.mDatas = mDatas;
    }

    @Override
    public int getCount() {
        return mDatas.size();
    }

    @Override
    public ITabView.TabBadge getBadge(int position) {
        return null;
    }

    @Override
    public ITabView.TabIcon getIcon(int position) {
        return null;
    }

    @Override
    public ITabView.TabTitle getTitle(int position) {
        DishType dishType = (DishType) mDatas.get(position);
        return new QTabView.TabTitle.Builder().setTextColor(Color.WHITE, Color.GRAY)
                                              .setContent(dishType.dishTypeName).build();
    }

    @Override
    public int getBackground(int position) {
        return 0;
    }
}
